home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-pppext-hdlc-framing-02.txt < prev    next >
Text File  |  1993-09-07  |  38KB  |  1,209 lines

  1.  
  2.  
  3. Network Working Group                                        W A Simpson
  4. Internet Draft                                                Daydreamer
  5. expires in six months                                     September 1993
  6.  
  7.  
  8.                           PPP in HDLC Framing
  9.  
  10.  
  11.  
  12. Status of this Memo
  13.  
  14.    This document is the product of the Point-to-Point Protocol Working
  15.    Group of the Internet Engineering Task Force (IETF).  Comments should
  16.    be submitted to the ietf-ppp@ucdavis.edu mailing list.
  17.  
  18.    Distribution of this memo is unlimited.
  19.  
  20.    This document is an Internet Draft.  Internet Drafts are working
  21.    documents of the Internet Engineering Task Force (IETF), its Areas,
  22.    and its Working Groups.  Note that other groups may also distribute
  23.    working documents as Internet Drafts.
  24.  
  25.    Internet Drafts are draft documents valid for a maximum of six
  26.    months.  Internet Drafts may be updated, replaced, or obsoleted by
  27.    other documents at any time.  It is not appropriate to use Internet
  28.    Drafts as reference material or to cite them other than as a
  29.    ``working draft'' or ``work in progress.''
  30.  
  31.    Please check the 1id-abstracts.txt listing contained in the
  32.    internet-drafts Shadow Directories on nic.ddn.mil, nnsc.nsf.net,
  33.    nic.nordu.net, ftp.nisc.sri.com, or munnari.oz.au to learn the
  34.    current status of any Internet Draft.
  35.  
  36. Abstract
  37.  
  38.    The Point-to-Point Protocol (PPP) [1] provides a standard method for
  39.    transporting multi-protocol datagrams over point-to-point links.
  40.  
  41.    This document describes the use of HDLC for framing PPP encapsulated
  42.    packets.
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. Simpson                  expires in six months                  [Page i]
  55. DRAFT                         HDLC Framing                September 1993
  56.  
  57.  
  58. 1.  Introduction
  59.  
  60.    This specification provides for framing over both bit-oriented and
  61.    octet-oriented synchronous links, and asynchronous links with 8 bits
  62.    of data and no parity.  These links MUST be full-duplex, but MAY be
  63.    either dedicated or circuit-switched.  PPP uses HDLC as a basis for
  64.    the framing.
  65.  
  66.    An escape mechanism is specified to allow control data such as
  67.    XON/XOFF to be transmitted transparently over the link, and to remove
  68.    spurious control data which may be injected into the link by
  69.    intervening hardware and software.
  70.  
  71.    Some protocols expect error free transmission, and either provide
  72.    error detection only on a conditional basis, or do not provide it at
  73.    all.  PPP uses the HDLC Frame Check Sequence for error detection.
  74.    This is commonly available in hardware implementations, and a
  75.    software implementation is provided.
  76.  
  77.  
  78. 1.1.  Specification of Requirements
  79.  
  80.    In this document, several words are used to signify the requirements
  81.    of the specification.  These words are often capitalized.
  82.  
  83.    MUST      This word, or the adjective "required", means that the
  84.              definition is an absolute requirement of the specification.
  85.  
  86.    MUST NOT  This phrase means that the definition is an absolute
  87.              prohibition of the specification.
  88.  
  89.    SHOULD    This word, or the adjective "recommended", means that there
  90.              may exist valid reasons in particular circumstances to
  91.              ignore this item, but the full implications must be
  92.              understood and carefully weighed before choosing a
  93.              different course.
  94.  
  95.    MAY       This word, or the adjective "optional", means that this
  96.              item is one of an allowed set of alternatives.  An
  97.              implementation which does not include this option MUST be
  98.              prepared to interoperate with another implementation which
  99.              does include the option.
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. Simpson                  expires in six months                  [Page 1]
  110. DRAFT                         HDLC Framing                September 1993
  111.  
  112.  
  113. 1.2.  Terminology
  114.  
  115.    This document frequently uses the following terms:
  116.  
  117.    datagram  The unit of transmission in the network layer (such as IP).
  118.              A datagram may be encapsulated in one or more packets
  119.              passed to the data link layer.
  120.  
  121.    frame     The unit of transmission at the data link layer.  A frame
  122.              may include a header and/or a trailer, along with some
  123.              number of units of data.
  124.  
  125.    packet    The basic unit of encapsulation, which is passed across the
  126.              interface between the network layer and the data link
  127.              layer.  A packet is usually mapped to a frame; the
  128.              exceptions are when data link layer fragmentation is being
  129.              performed, or when multiple packets are incorporated into a
  130.              single frame.
  131.  
  132.    peer      The other end of the point-to-point link.
  133.  
  134.    silently discard
  135.              This means the implementation discards the packet without
  136.              further processing.  The implementation SHOULD provide the
  137.              capability of logging the error, including the contents of
  138.              the silently discarded packet, and SHOULD record the event
  139.              in a statistics counter.
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164. Simpson                  expires in six months                  [Page 2]
  165. DRAFT                         HDLC Framing                September 1993
  166.  
  167.  
  168. 2.  Physical Layer Requirements
  169.  
  170.    PPP is capable of operating across most DTE/DCE interfaces (such as,
  171.    EIA RS-232-C, EIA RS-422, EIA RS-423 and CCITT V.35).  The only
  172.    absolute requirement imposed by PPP is the provision of a full-duplex
  173.    circuit, either dedicated or circuit-switched, which can operate in
  174.    either an asynchronous (start/stop), bit-synchronous, or octet-
  175.    synchronous mode, transparent to PPP Data Link Layer frames.
  176.  
  177.    Interface Format
  178.  
  179.       PPP presents an octet interface to the physical layer.  There is
  180.       no provision for sub-octets to be supplied or accepted.
  181.  
  182.    Transmission Rate
  183.  
  184.       PPP does not impose any restrictions regarding transmission rate,
  185.       other than that of the particular DTE/DCE interface.
  186.  
  187.    Control Signals
  188.  
  189.       PPP does not require the use of control signals, such as Request
  190.       To Send (RTS), Clear To Send (CTS), Data Carrier Detect (DCD), and
  191.       Data Terminal Ready (DTR).
  192.  
  193.       When available, using such signals can allow greater functionality
  194.       and performance.  In particular, such signals SHOULD be used to
  195.       signal the Up and Down events in the LCP Option Negotiation
  196.       Automaton [1].  When such signals are not available, the
  197.       implementation MUST signal the Up event to LCP upon
  198.       initialization, and SHOULD NOT signal the Down event.
  199.  
  200.       Because signalling is not required, the physical layer MAY be
  201.       decoupled from the data link layer, hiding the transient details
  202.       of the physical transport.  This has implications for mobility in
  203.       cellular radio networks, and other rapidly switching links.
  204.  
  205.       When moving from cell to cell within the same zone, an
  206.       implementation MAY choose to treat the entire zone as a single
  207.       link, even though transmission is switched among several
  208.       frequencies.  The link is considered to be with the central
  209.       control unit for the zone, rather than the individual cell
  210.       transceivers.  However, the link SHOULD re-establish its
  211.       configuration whenever the link is switched to a different
  212.       administration.
  213.  
  214.       Due to the bursty nature of data traffic, some implementations
  215.       have choosen to disconnect the physical layer during periods of
  216.  
  217.  
  218.  
  219. Simpson                  expires in six months                  [Page 3]
  220. DRAFT                         HDLC Framing                September 1993
  221.  
  222.  
  223.       inactivity, and reconnect when traffic resumes, without informing
  224.       the data link layer.  Robust implementations should avoid using
  225.       this trick over-zealously, since the price for decreased setup
  226.       latency is decreased security.  Implementations SHOULD signal the
  227.       Down event whenever "significant time" has elapsed since the link
  228.       was disconnected.  The value for "significant time" is a matter of
  229.       considerable debate, and is based on the tariffs, call setup
  230.       times, and security concerns of the installation.
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274. Simpson                  expires in six months                  [Page 4]
  275. DRAFT                         HDLC Framing                September 1993
  276.  
  277.  
  278. 3.  The Data Link Layer
  279.  
  280.    PPP uses the principles, terminology, and frame structure of the
  281.    International Organization For Standardization's (ISO) 3309-1979
  282.    High-level Data Link Control (HDLC) frame structure [2], as modified
  283.    by "Addendum 1: Start/stop transmission" [3], which specifies
  284.    modifications to allow HDLC use in asynchronous environments.
  285.  
  286.    The PPP control procedures use the definitions and Control field
  287.    encodings standardized in ISO 4335-1979 [4] and ISO 4335-
  288.    1979/Addendum 1-1979 [5].  PPP framing is also consistent with CCITT
  289.    Recommendation X.25 LAPB [6], and CCITT Recommendation Q.922 [7],
  290.    since those are also based on HDLC.
  291.  
  292.    The purpose of this specification is not to document what is already
  293.    standardized in ISO 3309.  It is assumed that the reader is already
  294.    familiar with HDLC, or has access to a copy of [2] or [6].  Instead,
  295.    this document attempts to give a concise summary and point out
  296.    specific options and features used by PPP.
  297.  
  298.    To remain consistent with standard Internet practice, and avoid
  299.    confusion for people used to reading RFCs, all binary numbers in the
  300.    following descriptions are in Most Significant Bit to Least
  301.    Significant Bit order, reading from left to right, unless otherwise
  302.    indicated.  Note that this is contrary to standard ISO and CCITT
  303.    practice which orders bits as transmitted (network bit order).  Keep
  304.    this in mind when comparing this document with the international
  305.    standards documents.
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329. Simpson                  expires in six months                  [Page 5]
  330. DRAFT                         HDLC Framing                September 1993
  331.  
  332.  
  333. 3.1.  Frame Format
  334.  
  335.    A summary of the PPP HDLC frame structure is shown below.  This
  336.    figure does not include start/stop bits (for asynchronous links), nor
  337.    any bits or octets inserted for transparency.  The fields are
  338.    transmitted from left to right.
  339.  
  340.            +----------+----------+----------+
  341.            |   Flag   | Address  | Control  |
  342.            | 01111110 | 11111111 | 00000011 |
  343.            +----------+----------+----------+
  344.            +----------+-------------+---------+
  345.            | Protocol | Information | Padding |
  346.            | 16 bits  |      *      |    *    |
  347.            +----------+-------------+---------+
  348.            +----------+----------+-----------------
  349.            |   FCS    |   Flag   | Inter-frame Fill
  350.            | 16 bits  | 01111110 | or next Address
  351.            +----------+----------+-----------------
  352.  
  353.    The Protocol, Information and Padding fields are described in the
  354.    Point-to-Point Protocol Encapsulation [1].
  355.  
  356.    Flag Sequence
  357.  
  358.       The Flag Sequence indicates the beginning or end of a frame, and
  359.       always consists of the binary sequence 01111110 (hexadecimal
  360.       0x7e).
  361.  
  362.       The Flag Sequence is a frame separator.  Only one Flag Sequence is
  363.       required between two frames.  Two consecutive Flag Sequences
  364.       constitute an empty frame, which is ignored, and not counted as a
  365.       FCS error.
  366.  
  367.    Address Field
  368.  
  369.       The Address field is a single octet and contains the binary
  370.       sequence 11111111 (hexadecimal 0xff), the All-Stations address.
  371.       PPP does not assign individual station addresses.  The All-
  372.       Stations address MUST always be recognized and received.  The use
  373.       of other address lengths and values may be defined at a later
  374.       time, or by prior agreement.  Frames with unrecognized Addresses
  375.       SHOULD be silently discarded.
  376.  
  377.    Control Field
  378.  
  379.       The Control field is a single octet and contains the binary
  380.       sequence 00000011 (hexadecimal 0x03), the Unnumbered Information
  381.  
  382.  
  383.  
  384. Simpson                  expires in six months                  [Page 6]
  385. DRAFT                         HDLC Framing                September 1993
  386.  
  387.  
  388.       (UI) command with the P/F bit set to zero.  The use of other
  389.       Control field values may be defined at a later time, or by prior
  390.       agreement.  Frames with unrecognized Control field values SHOULD
  391.       be silently discarded.
  392.  
  393.    Frame Check Sequence (FCS) Field
  394.  
  395.       The Frame Check Sequence field is normally 16 bits (two octets).
  396.       The use of other FCS lengths may be defined at a later time, or by
  397.       prior agreement.  The FCS is transmitted with the coefficient of
  398.       the highest term first.
  399.  
  400.       The FCS field is calculated over all bits of the Address, Control,
  401.       Protocol, Information and Padding fields, not including any start
  402.       and stop bits (asynchronous) nor any bits (synchronous) or octets
  403.       (asynchronous or synchronous) inserted for transparency.  This
  404.       also does not include the Flag Sequences nor the FCS field itself.
  405.  
  406.          Note: When octets are received which are flagged in the Async-
  407.          Control-Character-Map, they are discarded before calculating
  408.          the FCS.
  409.  
  410.       For more information on the specification of the FCS, see ISO 3309
  411.       [2] or CCITT X.25 [6].
  412.  
  413.    The end of the Information and Padding fields is found by locating
  414.    the closing Flag Sequence and removing the Frame Check Sequence
  415.    field.
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439. Simpson                  expires in six months                  [Page 7]
  440. DRAFT                         HDLC Framing                September 1993
  441.  
  442.  
  443. 3.2.  Modification of the Basic Frame
  444.  
  445.    The Link Control Protocol can negotiate modifications to the basic
  446.    HDLC frame structure.  However, modified frames will always be
  447.    clearly distinguishable from standard frames.
  448.  
  449.    Address-and-Control-Field-Compression
  450.  
  451.       When using the default HDLC framing, the Address and Control
  452.       fields contain the hexadecimal values 0xff and 0x03 respectively.
  453.  
  454.       On transmission, compressed Address and Control fields are formed
  455.       by simply omitting them.
  456.  
  457.       On reception, the Address and Control fields are decompressed by
  458.       examining the first two octets.  If they contain the values 0xff
  459.       and 0x03, they are assumed to be the Address and Control fields.
  460.       If not, it is assumed that the fields were compressed and were not
  461.       transmitted.
  462.  
  463.       By definition, the first octet of a two octet Protocol field will
  464.       never be 0xff (since it is not even).  The Protocol field value
  465.       0x00ff is not allowed (reserved) to avoid ambiguity when
  466.       Protocol-Field-Compression is enabled and the first Information
  467.       field octet is 0x03.
  468.  
  469.       When other Address or Control field values are in use, Address-
  470.       and-Control-Field-Compression MUST NOT be negotiated.
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494. Simpson                  expires in six months                  [Page 8]
  495. DRAFT                         HDLC Framing                September 1993
  496.  
  497.  
  498. 4.  Asynchronous HDLC
  499.  
  500.    This section summarizes the use of HDLC with 8-bit asynchronous
  501.    links.
  502.  
  503.    Flag Sequence
  504.  
  505.       The Flag Sequence indicates the beginning or end of a frame.  The
  506.       octet stream is examined on an octet-by-octet basis for the value
  507.       01111110 (hexadecimal 0x7e).
  508.  
  509.    Transparency
  510.  
  511.       An octet stuffing procedure is used.  The Control Escape octet is
  512.       defined as binary 01111101 (hexadecimal 0x7d) where the bit
  513.       positions are numbered 87654321 (not 76543210, BEWARE).
  514.  
  515.       Each end of the link maintains two Async-Control-Character-Maps.
  516.       The receiving ACCM is 32 bits, but the sending ACCM may be up to
  517.       256 bits.  This results in four distinct ACCMs, two in each
  518.       direction of the link.
  519.  
  520.       The default receiving ACCM is 0xffffffff.  The default sending
  521.       ACCM is 0xffffffff, plus the Control Escape and Flag Sequence
  522.       characters themselves, plus whatever other outgoing characters are
  523.       known to be intercepted.
  524.  
  525.       After FCS computation, the transmitter examines the entire frame
  526.       between the two Flag Sequences.  Each Flag Sequence, Control
  527.       Escape octet, and octet with value less than hexadecimal 0x20
  528.       which is flagged in the sending Async-Control-Character-Map, is
  529.       replaced by a two octet sequence consisting of the Control Escape
  530.       octet and the original octet with bit 6 complemented (exclusive-
  531.       or'd with hexadecimal 0x20).
  532.  
  533.       Prior to FCS computation, the receiver examines the entire frame
  534.       between the two Flag Sequences.  Each octet with value less than
  535.       hexadecimal 0x20 is checked.  If it is flagged in the receiving
  536.       Async-Control-Character-Map, it is simply removed (it may have
  537.       been inserted by intervening data communications equipment).  For
  538.       each Control Escape octet, that octet is also removed, but bit 6
  539.       of the following octet is complemented, unless it is the Flag
  540.       Sequence.
  541.  
  542.          Note: The inclusion of all octets less than hexadecimal 0x20
  543.          allows all ASCII control characters [8] excluding DEL (Delete)
  544.          to be transparently communicated through all known data
  545.          communications equipment.
  546.  
  547.  
  548.  
  549. Simpson                  expires in six months                  [Page 9]
  550. DRAFT                         HDLC Framing                September 1993
  551.  
  552.  
  553.       The transmitter may also send octets with value in the range 0x40
  554.       through 0xff (except 0x5e) in Control Escape format.  Since these
  555.       octet values are not negotiable, this does not solve the problem
  556.       of receivers which cannot handle all non-control characters.
  557.       Also, since the technique does not affect the 8th bit, this does
  558.       not solve problems for communications links that can send only 7-
  559.       bit characters.
  560.  
  561.       A few examples may make this more clear.  Packet data is
  562.       transmitted on the link as follows:
  563.  
  564.          0x7e is encoded as 0x7d, 0x5e.
  565.          0x7d is encoded as 0x7d, 0x5d.
  566.          0x01 is encoded as 0x7d, 0x21.
  567.  
  568.       Some modems with software flow control may intercept outgoing DC1
  569.       and DC3 ignoring the 8th (parity) bit.  This data would be
  570.       transmitted on the link as follows:
  571.  
  572.          0x11 is encoded as 0x7d, 0x31.
  573.          0x13 is encoded as 0x7d, 0x33.
  574.          0x91 is encoded as 0x7d, 0xb1.
  575.          0x93 is encoded as 0x7d, 0xb3.
  576.  
  577.  
  578.    Aborting a Transmission
  579.  
  580.       On asynchronous links, frames may be aborted by transmitting a "0"
  581.       stop bit where a "1" bit is expected (framing error) or by
  582.       transmitting a Control Escape octet followed immediately by a
  583.       closing Flag Sequence.
  584.  
  585.    Time Fill
  586.  
  587.       For asynchronous links, inter-octet and inter-frame time fill MUST
  588.       be accomplished by transmitting continuous "1" bits (mark-hold
  589.       state).
  590.  
  591.       Inter-frame time fill can be viewed as extended inter-octet time
  592.       fill.  Doing so can save one octet for every frame, decreasing
  593.       delay and increasing bandwidth.  This is possible since a Flag
  594.       Sequence may serve as both a frame close and a frame begin.  After
  595.       having received any frame, an idle receiver will always be in a
  596.       frame begin state.
  597.  
  598.       Robust transmitters should avoid using this trick over-zealously,
  599.       since the price for decreased delay is decreased reliability.
  600.       Noisy links may cause the receiver to receive garbage characters
  601.  
  602.  
  603.  
  604. Simpson                  expires in six months                 [Page 10]
  605. DRAFT                         HDLC Framing                September 1993
  606.  
  607.  
  608.       and interpret them as part of an incoming frame.  If the
  609.       transmitter does not send a new opening Flag Sequence before
  610.       sending the next frame, then that frame will be appended to the
  611.       noise characters causing an invalid frame (with high reliability).
  612.       It is suggested that implementations will achieve the best results
  613.       by always sending an opening Flag Sequence if the new frame is not
  614.       back-to-back with the last.  Transmitters SHOULD send an open Flag
  615.       Sequence whenever "appreciable time" has elapsed after the prior
  616.       closing Flag Sequence.  The maximum value for "appreciable time"
  617.       is likely to be no greater than the typing rate of a slow typist,
  618.       say 1 second.
  619.  
  620.    Encoding
  621.  
  622.       All octets are transmitted with one start bit, eight bits of data,
  623.       and one stop bit.  There is no provision for seven bit
  624.       asynchronous links.
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659. Simpson                  expires in six months                 [Page 11]
  660. DRAFT                         HDLC Framing                September 1993
  661.  
  662.  
  663. 5.  Bit-synchronous HDLC
  664.  
  665.    This section summarizes the use of HDLC with bit-synchronous links.
  666.  
  667.    Flag Sequence
  668.  
  669.       The Flag Sequence indicates the beginning or end of a frame, and
  670.       is used for frame synchronization.  The bit stream is examined on
  671.       a bit-by-bit basis for the binary sequence 01111110 (hexadecimal
  672.       0x7e).
  673.  
  674.       The "shared zero mode" Flag Sequence "011111101111110" SHOULD NOT
  675.       be used.  When not avoidable, such an implementation MUST ensure
  676.       that the first Flag Sequence detected (the end of the frame) is
  677.       promptly communicated to the link layer.  Use of the shared zero
  678.       mode hinders interoperability with synchronous-to-asynchronous
  679.       converters.
  680.  
  681.    Transparency
  682.  
  683.       The transmitter examines the entire frame between the two Flag
  684.       Sequences.  A "0" bit is inserted after all sequences of five
  685.       contiguous "1" bits (including the last 5 bits of the FCS) to
  686.       ensure that a Flag Sequence is not simulated.
  687.  
  688.       When receiving, any "0" bit that directly follows five contiguous
  689.       "1" bits is discarded.
  690.  
  691.       Since the Control Escape octet-stuffing method is not used, the
  692.       default receiving and sending Async-Control-Character-Maps are 0.
  693.  
  694.       There may be some use of synchronous-to-asynchronous converters
  695.       (some built into modems) in point-to-point links resulting in a
  696.       synchronous PPP implementation on one end of a link and an
  697.       asynchronous implementation on the other.  It is the
  698.       responsibility of the converter to do all mapping conversions
  699.       during operation.
  700.  
  701.       To enable this functionality, bit-synchronous PPP implementations
  702.       MUST always respond to the Async-Control-Character-Map
  703.       Configuration Option with an LCP Configure-Ack.  However,
  704.       acceptance of the Configuration Option does not imply that the
  705.       bit-synchronous implementation will do any octet mapping.
  706.       Instead, all such octet mapping will be performed by the
  707.       asynchronous-to-synchronous converter.
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714. Simpson                  expires in six months                 [Page 12]
  715. DRAFT                         HDLC Framing                September 1993
  716.  
  717.  
  718.    Aborting a Transmission
  719.  
  720.       A sequence of more than six "1" bits indicates an invalid frame,
  721.       which is ignored, and not counted as a FCS error.
  722.  
  723.    Inter-frame Time Fill
  724.  
  725.       For bit-synchronous links, the Flag Sequence SHOULD be transmitted
  726.       during inter-frame time fill.  There is no provision for inter-
  727.       octet time fill.
  728.  
  729.       Mark idle (continuous ones) SHOULD NOT be used for inter-frame
  730.       time fill.  However, certain types of circuit-switched links
  731.       require the use of mark idle, particularly those that calculate
  732.       accounting based on periods of bit activity.  When mark idle is
  733.       used on a bit-synchronous link, the implementation MUST ensure at
  734.       least 15 consecutive "1" bits between Flags during the idle
  735.       period, and that the Flag Sequence is always generated at the
  736.       beginning of a frame after an idle period.
  737.  
  738.    Encoding
  739.  
  740.       The definition of various encodings and scrambling is the
  741.       responsibility of the DTE/DCE equipment in use, and is outside the
  742.       scope of this specification.
  743.  
  744.       While PPP will operate without regard to the underlying
  745.       representation of the bit stream, lack of standards for
  746.       transmission will hinder interoperability as surely as lack of
  747.       data link standards.  At speeds of 56 Kbps through 2.0 Mbps, NRZ
  748.       is currently most widely available, and on that basis is
  749.       recommended as a default.
  750.  
  751.       When configuration of the encoding is allowed, NRZI is recommended
  752.       as an alternative, because of its relative immunity to signal
  753.       inversion configuration errors, and instances when it MAY allow
  754.       connection without an expensive DSU/CSU.  Unfortunately, NRZI
  755.       encoding obviates the (1 + x) factor of the 16-bit FCS, so that
  756.       one error in 2**15 goes undetected (instead of one in 2**16), and
  757.       triple errors are not detected.  Therefore, when NRZI is in use,
  758.       it is recommended that the 32-bit FCS be negotiated, which does
  759.       not include the (1 + x) factor.
  760.  
  761.       At higher speeds of up to 45 Mbps, some implementors have chosen
  762.       the ANSI High Speed Synchronous Interface [HSSI].  While this
  763.       experience is currently limited, implementors are encouraged to
  764.       cooperate in choosing transmission encoding.
  765.  
  766.  
  767.  
  768.  
  769. Simpson                  expires in six months                 [Page 13]
  770. DRAFT                         HDLC Framing                September 1993
  771.  
  772.  
  773. 6.  Octet-synchronous HDLC
  774.  
  775.    This section summarizes the use of HDLC with octet-synchronous links,
  776.    such as SONET and optionally ISDN B or H channels.
  777.  
  778.    Although the bit rate is synchronous, there is no bit-stuffing.
  779.    Instead, the octet-stuffing feature of 8-bit asynchronous HDLC is
  780.    used.
  781.  
  782.    Flag Sequence
  783.  
  784.       The Flag Sequence indicates the beginning or end of a frame.  The
  785.       octet stream is examined on an octet-by-octet basis for the value
  786.       01111110 (hexadecimal 0x7e).
  787.  
  788.    Transparency
  789.  
  790.       An octet stuffing procedure is used.  The Control Escape octet is
  791.       defined as binary 01111101 (hexadecimal 0x7d).
  792.  
  793.       The octet stuffing procedure is described in "Asynchronous HDLC"
  794.       above.
  795.  
  796.       The sending and receiving implementations need escape only the
  797.       Flag Sequence and Control Escape octets.
  798.  
  799.       Considerations concerning the use of converters are described in
  800.       "Bit-synchronous HDLC" above.
  801.  
  802.    Aborting a Transmission
  803.  
  804.       Frames may be aborted by transmitting a Control Escape octet
  805.       followed immediately by a closing Flag Sequence.  The preceding
  806.       frame is ignored, and not counted as a FCS error.
  807.  
  808.    Inter-frame Time Fill
  809.  
  810.       The Flag Sequence MUST be transmitted during inter-frame time
  811.       fill.  There is no provision for inter-octet time fill.
  812.  
  813.    Encoding
  814.  
  815.       The definition of various encodings and scrambling is the
  816.       responsibility of the DTE/DCE equipment in use, and is outside the
  817.       scope of this specification.
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824. Simpson                  expires in six months                 [Page 14]
  825. DRAFT                         HDLC Framing                September 1993
  826.  
  827.  
  828. A.  Fast Frame Check Sequence (FCS) Implementation
  829.  
  830.    The FCS was originally designed with hardware implementations in
  831.    mind.  A serial bit stream is transmitted on the wire, the FCS is
  832.    calculated over the serial data as it goes out, and the complement of
  833.    the resulting FCS is appended to the serial stream, followed by the
  834.    Flag Sequence.
  835.  
  836.    The receiver has no way of determining that it has finished
  837.    calculating the received FCS until it detects the Flag Sequence.
  838.    Therefore, the FCS was designed so that a particular pattern results
  839.    when the FCS operation passes over the complemented FCS.  A good
  840.    frame is indicated by this "good FCS" value.
  841.  
  842.  
  843. A.1.  FCS Computation Method
  844.  
  845.    The following code provides a table lookup computation for
  846.    calculating the Frame Check Sequence as data arrives at the
  847.    interface.  This implementation is based on [9], [10], and [11].  The
  848.    table is created by the code in section B.2.
  849.  
  850.    /*
  851.     * u16 represents an unsigned 16-bit number.  Adjust the typedef for
  852.     * your hardware.
  853.     */
  854.    typedef unsigned short u16;
  855.  
  856.  
  857.    /*
  858.     * FCS lookup table as calculated by the table generator in section B.2.
  859.     */
  860.    static u16 fcstab[256] = {
  861.       0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
  862.       0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
  863.       0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
  864.       0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
  865.       0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
  866.       0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
  867.       0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
  868.       0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
  869.       0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
  870.       0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
  871.       0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
  872.       0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
  873.       0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
  874.       0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
  875.       0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
  876.  
  877.  
  878.  
  879. Simpson                  expires in six months                 [Page 15]
  880. DRAFT                         HDLC Framing                September 1993
  881.  
  882.  
  883.       0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
  884.       0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
  885.       0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
  886.       0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
  887.       0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
  888.       0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
  889.       0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
  890.       0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
  891.       0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
  892.       0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
  893.       0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
  894.       0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
  895.       0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
  896.       0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
  897.       0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
  898.       0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
  899.       0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
  900.    };
  901.  
  902.    #define PPPINITFCS16    0xffff  /* Initial FCS value */
  903.    #define PPPGOODFCS16    0xf0b8  /* Good final FCS value */
  904.  
  905.    /*
  906.     * Calculate a new fcs given the current fcs and the new data.
  907.     */
  908.    u16 pppfcs16(fcs, cp, len)
  909.        register u16 fcs;
  910.        register unsigned char *cp;
  911.        register int len;
  912.    {
  913.        ASSERT(sizeof (u16) == 2);
  914.        ASSERT(((u16) -1) > 0);
  915.        while (len--)
  916.            fcs = (fcs >> 8) ^ fcstab[(fcs ^ *cp++) & 0xff];
  917.  
  918.        return (fcs);
  919.    }
  920.  
  921.    /*
  922.     * How to use the fcs
  923.     */
  924.    tryfcs16(cp, len)
  925.        register unsigned char *cp;
  926.        register int len;
  927.    {
  928.        u16 trialfcs;
  929.  
  930.        /* add on output */
  931.  
  932.  
  933.  
  934. Simpson                  expires in six months                 [Page 16]
  935. DRAFT                         HDLC Framing                September 1993
  936.  
  937.  
  938.        trialfcs = pppfcs16( PPPINITFCS16, cp, len );
  939.        trialfcs ^= 0xffff;                 /* complement */
  940.        cp[len] = (trialfcs & 0x00ff);      /* least significant byte first */
  941.        cp[len+1] = ((trialfcs >> 8) & 0x00ff);
  942.  
  943.        /* check on input */
  944.        trialfcs = pppfcs16( PPPINITFCS16, cp, len + 2 );
  945.        if ( trialfcs == PPPGOODFCS16 )
  946.            printf("Good FCS\n");
  947.    }
  948.  
  949.  
  950. A.2.  Fast FCS table generator
  951.  
  952.    The following code creates the lookup table used to calculate the
  953.    FCS.
  954.  
  955.    /*
  956.     * Generate a FCS table for the HDLC FCS.
  957.     *
  958.     * Drew D. Perkins at Carnegie Mellon University.
  959.     *
  960.     * Code liberally borrowed from Mohsen Banan and D. Hugh Redelmeier.
  961.     */
  962.  
  963.    /*
  964.     * The HDLC polynomial: x**0 + x**5 + x**12 + x**16 (0x8408).
  965.     */
  966.    #define P       0x8408
  967.  
  968.  
  969.    main()
  970.    {
  971.        register unsigned int b, v;
  972.        register int i;
  973.  
  974.        printf("typedef unsigned short u16;\n");
  975.        printf("static u16 fcstab[256] = {");
  976.        for (b = 0; ; ) {
  977.            if (b % 8 == 0)
  978.                printf("\n");
  979.  
  980.            v = b;
  981.            for (i = 8; i--; )
  982.                v = v & 1 ? (v >> 1) ^ P : v >> 1;
  983.  
  984.            printf("\t0x%04x", v & 0xFFFF);
  985.            if (++b == 256)
  986.  
  987.  
  988.  
  989. Simpson                  expires in six months                 [Page 17]
  990. DRAFT                         HDLC Framing                September 1993
  991.  
  992.  
  993.                break;
  994.            printf(",");
  995.        }
  996.        printf("\n};\n");
  997.    }
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044. Simpson                  expires in six months                 [Page 18]
  1045. DRAFT                         HDLC Framing                September 1993
  1046.  
  1047.  
  1048. Security Considerations
  1049.  
  1050.    As noted in the Physical Layer Requirements section, the link layer
  1051.    might not be informed when the connected state of physical layer is
  1052.    changed.  This results in possible security lapses due to over-
  1053.    reliance on the integrity and security of switching systems and
  1054.    administrations.  An insertion attack might be undetected.  An
  1055.    attacker which is able to spoof the same calling identity might be
  1056.    able to avoid link authentication.
  1057.  
  1058.  
  1059. References
  1060.  
  1061.    [1]   Simpson, W. A., "The Point-to-Point Protocol (PPP)", work in
  1062.          progress.
  1063.  
  1064.    [2]   International Organization For Standardization, ISO Standard
  1065.          3309-1979, "Data communication - High-level data link control
  1066.          procedures - Frame structure", 1979.
  1067.  
  1068.    [3]   International Organization For Standardization, Proposed Draft
  1069.          International Standard ISO 3309-1991/PDAD1, "Information
  1070.          processing systems - Data communication - High-level data link
  1071.          control procedures - Frame structure - Addendum 1: Start/stop
  1072.          transmission", 1991.
  1073.  
  1074.    [4]   International Organization For Standardization, ISO Standard
  1075.          4335-1979, "Data communication - High-level data link control
  1076.          procedures - Elements of procedures", 1979.
  1077.  
  1078.    [5]   International Organization For Standardization, ISO Standard
  1079.          4335-1979/Addendum 1, "Data communication - High-level data
  1080.          link control procedures - Elements of procedures - Addendum 1",
  1081.          1979.
  1082.  
  1083.    [6]   International Telecommunication Union, CCITT Recommendation
  1084.          X.25, "Interface Between Data Terminal Equipment (DTE) and Data
  1085.          Circuit Terminating Equipment (DCE) for Terminals Operating in
  1086.          the Packet Mode on Public Data Networks", CCITT Red Book,
  1087.          Volume VIII, Fascicle VIII.3, Rec. X.25., October 1984.
  1088.  
  1089.    [7]   International Telegraph and Telephone Consultative Committee,
  1090.          CCITT Recommendation Q.922, "ISDN Data Link Layer Specification
  1091.          for Frame Mode Bearer Services", April 1991.
  1092.  
  1093.    [8]   American National Standards Institute, ANSI X3.4-1977,
  1094.          "American National Standard Code for Information Interchange",
  1095.          1977.
  1096.  
  1097.  
  1098.  
  1099. Simpson                  expires in six months                 [Page 19]
  1100. DRAFT                         HDLC Framing                September 1993
  1101.  
  1102.  
  1103.    [9]   Perez, "Byte-wise CRC Calculations", IEEE Micro, June, 1983.
  1104.  
  1105.    [10]  Morse, G., "Calculating CRC's by Bits and Bytes", Byte,
  1106.          September 1986.
  1107.  
  1108.    [11]  LeVan, J., "A Fast CRC", Byte, November 1987.
  1109.  
  1110.  
  1111. Acknowledgments
  1112.  
  1113.    This specification is based on previous RFCs, where many
  1114.    contributions have been acknowleged.
  1115.  
  1116.    Additional implementation detail for this version was provided by
  1117.    Fred Baker (ACC), Craig Fox (NSC), and Phil Karn (Qualcomm).
  1118.  
  1119.    Special thanks to Morning Star Technologies for providing computing
  1120.    resources and network access support for writing this specification.
  1121.  
  1122.  
  1123. Chair's Address
  1124.  
  1125.    The working group can be contacted via the current chair:
  1126.  
  1127.       Fred Baker
  1128.       Advanced Computer Communications
  1129.       315 Bollay Drive
  1130.       Santa Barbara, California, 93111
  1131.  
  1132.       EMail: fbaker@acc.com
  1133.  
  1134.  
  1135. Editor's Address
  1136.  
  1137.    Questions about this memo can also be directed to:
  1138.  
  1139.       William Allen Simpson
  1140.       Daydreamer
  1141.       Computer Systems Consulting Services
  1142.       1384 Fontaine
  1143.       Madison Heights, Michigan  48071
  1144.  
  1145.       EMail: Bill.Simpson@um.cc.umich.edu
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154. Simpson                  expires in six months                 [Page 20]
  1155. DRAFT                         HDLC Framing                September 1993
  1156.  
  1157.  
  1158.                            Table of Contents
  1159.  
  1160.  
  1161.      1.     Introduction ..........................................    1
  1162.         1.1       Specification of Requirements ...................    1
  1163.         1.2       Terminology .....................................    2
  1164.  
  1165.      2.     Physical Layer Requirements ...........................    3
  1166.  
  1167.      3.     The Data Link Layer ...................................    5
  1168.         3.1       Frame Format ....................................    6
  1169.         3.2       Modification of the Basic Frame .................    8
  1170.  
  1171.      4.     Asynchronous HDLC .....................................    9
  1172.  
  1173.      5.     Bit-synchronous HDLC ..................................   12
  1174.  
  1175.      6.     Octet-synchronous HDLC ................................   14
  1176.  
  1177.      APPENDICES ...................................................   15
  1178.  
  1179.      A.     Fast Frame Check Sequence (FCS) Implementation ........   15
  1180.         A.1       FCS Computation Method ..........................   15
  1181.         A.2       Fast FCS table generator ........................   17
  1182.  
  1183.      SECURITY CONSIDERATIONS ......................................   19
  1184.  
  1185.      REFERENCES ...................................................   19
  1186.  
  1187.      ACKNOWLEDGEMENTS .............................................   20
  1188.  
  1189.      CHAIR'S ADDRESS ..............................................   20
  1190.  
  1191.      EDITOR'S ADDRESS .............................................   20
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.